home *** CD-ROM | disk | FTP | other *** search
- ±b2 DOT-OBJECTS - AN×
-
-
- ±b2 APPROACH!!
-
-
- ±22By Fizban/Compact
-
- ±41I guess you all have seen traditional
- vector-dot objects like "balls" etc.
- But how are the data for this kind of
- object made? Are they written down
- manually like in the avarage filled
- vector? Of course not! Who would
- have the patience to write down
- XYZ-data for a thousand+ dots? Here's
- where a couple of formulas come in
- handy...... Lets imagine a sphere.
- It will, just like a globe, have both
- a longitude and a latitude. The
- longitude is the north-south direction
- of the sphere, while the latitude is
- the east-west direction. Both these
- numbers are from 0 to 360 degrees.
- This means that we'll need two
- numbers, written in degrees, to
- calculate the X, Y and Z position of
- the point.
-
- ±23And here's the formula:
-
- ±41D1 = Longitude (Degree 1)
- D2 = Latitude (Degree 2)
-
- X = Sin(D1)*Cos(D2)
- Y = Sin(D1)*Sin(D2)
- Z = Cos(D1)
-
-
-
- ±22Let's have an example:
- ±41Lea Points,a0 ;Points-table
- Lea Sinus,a1 ;Sinus-table
- Lea Sinus+180,a2 ;Cosinus-table
- Move.l #10,d0 ;Longtitude
- Move.l #56,d1 ;Latitude
- Add d0,d0 ;D0=Word pointer
- Add d1,d1 ;D1-----""------
- Move.w (a1,d0.w),d2 ;Sin(D1)
- Muls (a2,d1.w),d2 ;Sin(D1)*Cos(D2)
- Swap d2 ;Scale down
- Move.w d2,(a0)+ ;Store X
- Move.w (a1,d0.w),d2 ;Sin(D1)
- Muls (a1,d1.w),d2 ;Sin(D1)*Sin(D2)
- Swap d2 ;Scale down
- Move.w d2,(a0)+ ;Store Y
- Move.w (a2,d0.w),d2 ;Cos(D1)
- Asr #8,d2 ;Scale down
- Move.w d2,(a0)+ ;Store Z
- Rts
- ±41Now you can start making a loop which
- calculates, let's say 1000 dots. For
- this purpose you can use randomized
- numbers for Long. and Lat. or you
- can add with a constant for each
- point. When the dots are calculated
- you will of course have to rotate
- them. For this you use an ordinary
- rotate routine. I will not explain
- the rotation in this article.
-
- This example was for a sphere, but
- with a little fantasy (and luck) you
- can create some weird objects. Let's
- say you instead of X= sin(D1)*cos(D2)
- use X= Sin(D1+90)*Cos(D2+45)........
- The possibilities are almost infinite.
- Once I managed to create a sort of a
- mug(?)....... So start experimenting!
- ç